package com.ruoyi.mall.service.impl;

import java.util.List;
import com.ruoyi.common.core.utils.DateUtils;
import com.ruoyi.common.core.utils.PrimaryKeyIdUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.mall.mapper.PaymentMapper;
import com.ruoyi.mall.domain.Payment;
import com.ruoyi.mall.service.IPaymentService;

/**
 * 支付流水Service业务层处理
 * 
 * @author luogongquan
 * @date 2024-10-17
 */
@Service
public class PaymentServiceImpl implements IPaymentService 
{
    @Autowired
    private PaymentMapper paymentMapper;

    /**
     * 查询支付流水
     * 
     * @param id 支付流水主键
     * @return 支付流水
     */
    @Override
    public Payment selectPaymentById(Long id)
    {
        return paymentMapper.selectPaymentById(id);
    }
   /**
     * 查询支付流水
     *
     * @param orderId 支付流水主键
     * @return 支付流水
     */
    @Override
    public Payment selectPaymentByOrderId(Long orderId)
    {
        return paymentMapper.selectPaymentByOrderId(orderId);
    }

    /**
     * 查询支付流水列表
     * 
     * @param payment 支付流水
     * @return 支付流水
     */
    @Override
    public List<Payment> selectPaymentList(Payment payment)
    {
        return paymentMapper.selectPaymentList(payment);
    }

    /**
     * 新增支付流水
     * 
     * @param payment 支付流水
     * @return 结果
     */
    @Override
    public int insertPayment(Payment payment)
    {
        payment.setId(PrimaryKeyIdUtils.getSysIdWorker().nextId());
        payment.setCreateTime(DateUtils.getNowDate());
        return paymentMapper.insertPayment(payment);
    }

    /**
     * 修改支付流水
     * 
     * @param payment 支付流水
     * @return 结果
     */
    @Override
    public int updatePayment(Payment payment)
    {
        payment.setUpdateTime(DateUtils.getNowDate());
        return paymentMapper.updatePayment(payment);
    }

    /**
     * 批量删除支付流水
     * 
     * @param ids 需要删除的支付流水主键
     * @return 结果
     */
    @Override
    public int deletePaymentByIds(Long[] ids)
    {
        return paymentMapper.deletePaymentByIds(ids);
    }

    /**
     * 删除支付流水信息
     * 
     * @param id 支付流水主键
     * @return 结果
     */
    @Override
    public int deletePaymentById(Long id)
    {
        return paymentMapper.deletePaymentById(id);
    }
}
